//
//  FirstOpenAppView.m
//  SuperRadio
//
//  Created by Damon on 14/12/18.
//  Copyright (c) 2014年 三个臭皮匠. All rights reserved.
//

#import "FirstOpenAppView.h"

@interface FirstOpenAppView()<UIScrollViewDelegate>

//定义一个page,用来记录当前显示页
@property(nonatomic, assign)unsigned int index;
//记录控件的高
@property(nonatomic, assign)NSInteger height;
//记录控件的宽
@property(nonatomic, assign)NSInteger width;
//存储照片数量
@property(nonatomic, assign)unsigned int count;

//图片数组
@property(nonatomic, retain)NSArray *arr;
//pageControl
@property(nonatomic, retain)UIPageControl *pageControl;


@end

@implementation FirstOpenAppView

- (instancetype)initWithFrame:(CGRect)frame
{
    
    self = [super initWithFrame:frame];
    if (self) {
        //成员变量赋值
        self.backgroundColor = [UIColor cyanColor];
        self.width = frame.size.width;
        self.height = frame.size.height;
        self.index = 0;
        
        self.scrollView = [[UIScrollView alloc]initWithFrame:frame];
        
        //创建MyscrollView的大小,大小等于照片的数量加2乘以宽度
        self.scrollView.contentSize = CGSizeMake(self.width *3, 0);
        //MyscrollView可以滑动
        self.scrollView.scrollEnabled = YES;
        //MyscrollView设置代理
        self.scrollView.delegate = self;
        self.backgroundColor = [UIColor cyanColor];
        self.scrollView.pagingEnabled = YES;
        //初始化偏移量为第一张图片的位置
        self.scrollView.contentOffset = CGPointMake(0, 0);
        //影藏水平滑动条
        self.scrollView.showsHorizontalScrollIndicator = NO;
        self.scrollView.bounces = NO;
        [self addSubview:self.scrollView];
        [_scrollView release];
        
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
        
        NSString *path = [[NSBundle mainBundle] pathForResource:@"noe" ofType:@"jpg"];
        
        
        UIImage *image = [UIImage imageWithContentsOfFile:path];
        
        
        [imageView setImage:image];
        
        [self.scrollView addSubview:imageView];
        [imageView release];
        
        
        UIImageView *imageViewOne = [[UIImageView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
        
        NSString *pathOne = [[NSBundle mainBundle] pathForResource:@"tow" ofType:@"jpg"];
        
        UIImage *imageOne = [UIImage imageWithContentsOfFile:pathOne];
        
        
        [imageViewOne setImage:imageOne];
        
        [self.scrollView addSubview:imageViewOne];
        [imageViewOne release];
        
        
        
        UIImageView *imageViewTwo = [[UIImageView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width * 2, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
        
        NSString *pathTwo = [[NSBundle mainBundle] pathForResource:@"three" ofType:@"jpg"];
        
        
        UIImage *imageTwo = [UIImage imageWithContentsOfFile:pathTwo];
        
        
        [imageViewTwo setImage:imageTwo];
        
        [self.scrollView addSubview:imageViewTwo];
        [imageViewTwo release];
        
    }
    
    return self;
    
}



- (void)dealloc
{
    [_scrollView release];
    [_pageControl release];
    [super dealloc];
}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

@end
